package com.gxdf.uc.data;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.LinearLayout.LayoutParams;

public class GxdfRadioGroup extends GxdfField {
	
	RadioGroup rg;
	ArrayList<String> options;
	Context context;

	public GxdfRadioGroup(Context context, Field f) {
		super(context,f);
		
		this.context = context;
		
		this.options = new ArrayList<String>();
		rg = new RadioGroup(context);
		rg.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
		rg.setOrientation(VERTICAL);
		
		this.options.addAll(options);
		
	}


	private void renderOptions(Context context){
		
		
	}

	@Override
	public void drawField() {
		
		
		for(String ops : this.options){			
			RadioButton rb = new RadioButton(this.context);
			rb.setText(ops);			
			rg.addView(rb);
		}
		
		this.addView(rg);
	}

	@Override
	public String getValue() {		
		String value = ((RadioButton) findViewById(this.rg.getCheckedRadioButtonId())).getText().toString();
		return value;
	}


	@Override
	public void saveValues() {
		// TODO Auto-generated method stub
		
	}


	@Override
	public boolean isModified() {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	public List<String> getActualValues() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	protected boolean errorFormat() {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	protected boolean errorLength() {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	public boolean isFieldvalid() {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	public void runValidationRules() {
		// TODO Auto-generated method stub
		
	}

	
}
